<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="./js/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="myAppControl">
	<h3 ng-bind="username"></h3>
	<h4 ng-repeat="x in arr">{{x.Name+"----"+x.Url+"----"+x.Country}}</h4>
</div>
<script type="text/javascript">
var url = "http://127.0.0.1/angular/json.json";
var myApp = angular.module('myApp',[]);
var data = "";
myApp.controller("myAppControl",function($scope,$http){
	data = "";
	$http.get(url,data).then(function(res){
		console.log(res);
	},function(res){
		console.log(res);
	});
	// GET请求 当页面中有很多的 异步请求的时候，可以分装 请求方法
	var data = {name:'张三'};
	ajaxGet(url,data,function(res){
		console.log(res);
	});
	function ajaxGet(url,data,fun){
	    $http.get(url,{params:data}).then(function(res){
	        fun(res);
	    });
	};
});
myApp.controller("myAppControl",function($scope,$http){
	$scope.username = "张三";
	$http({method:"POST",url:url}).then(function(res){
		$scope.arr = res.data.sites
	},function(res){
		console.log(res);
	});
});
</script>
</body>
</html>